Skip to content

Tests: add regression tests for FilterRange with zero value#1275

Merged
f3l1x merged 1 commit intomasterfrom
fix/filter-range-zero-value
Mar 17, 2026
Merged

Tests: add regression tests for FilterRange with zero value#1275
f3l1x merged 1 commit intomasterfrom
fix/filter-range-zero-value

Conversation

@radimvaculik
Copy link
Copy Markdown
Member

Closes #730

Summary

  • The bug was already fixed in the codebase (ArraysHelper::testEmpty handles '0' and all data source applyFilterRange implementations use !== '' or is_numeric()), but no regression tests existed
  • Added testFilterRangeWithZeroToValue to BaseDataSourceTest — runs against all 7 data sources; sets to = '0' and expects empty results (all ages in test data are > 0, so if the filter were ignored it would return all 6 records)
  • Added testFilterRangeWithZeroFromValue to ArrayDataSourceTest — uses a custom dataset with negative/zero/positive values; sets from = '0' and expects 2 results (age ≥ 0)

Test plan

  • make tests passes (29 tests, 0 failures)

Verify that '0' is correctly treated as a valid filter value in FilterRange,
not skipped as if no filter was provided.
@sonarqubecloud
Copy link
Copy Markdown

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.79%. Comparing base (15713e0) to head (1db518d).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1275   +/-   ##
=======================================
  Coverage   46.79%   46.79%           
=======================================
  Files          53       53           
  Lines        2729     2729           
=======================================
  Hits         1277     1277           
  Misses       1452     1452           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@f3l1x f3l1x merged commit e5faff0 into master Mar 17, 2026
11 checks passed
@f3l1x f3l1x deleted the fix/filter-range-zero-value branch March 17, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The FilterRange filter does not work with a zero value

2 participants